package com.ruoyi.common.service.business.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.core.pagination.Paging;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ruoyi.common.core.pagination.PageInfo;
import com.ruoyi.common.param.OrdersParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.mapper.business.OrdersMapper;
import com.ruoyi.common.domain.business.Orders;
import com.ruoyi.common.service.business.OrdersService;

/**
 * 订单Service业务层处理
 *
 * @author Song
 * @date 2024-10-29
 */
@Service
public class OrdersServiceImpl extends ServiceImpl<OrdersMapper, Orders> implements OrdersService {

    @Autowired
    private OrdersMapper ordersMapper;

    /**
     * 查询订单列表
     *
     * @param orders 订单
     * @return 订单
     */
    public Paging<Orders> pageOrders(OrdersParam orders) {
        LambdaQueryWrapper<Orders> wrapper = new LambdaQueryWrapper<Orders>();
        Page<Orders> page = new PageInfo<>(orders);
        IPage<Orders> iPage = this.page(page, wrapper);
        // 最终返回分页对象
//        IPage<OrdersVo> resultPage = iPage.convert(item -> {
//            OrdersVo vo = new OrdersVo();
//            BeanUtil.copyProperties(item, vo);
//            return vo;
//        });
        return new Paging(iPage);
    }
}



